package everydayGrade.t3;

import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.Collections;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @Author: Siantar
 * @Date: 2023-09-30-13:59
 * @Description: 1.0
 */
public class T2136 {
    public int earliestFullBloom(int[] plantTime, int[] growTime) {
        int n = growTime.length;
        Integer[] index = new Integer[n];
        for (int i = 0; i < n; i++) {
            index[i]=i;
        }
        Arrays.sort(index, (a, b) -> growTime[b] - growTime[a]);
        int days=0,res=0;
        for(int i:index){
            days+=plantTime[i];
            res=Math.max(res,days+growTime[i]);
        }
        return res;
    }

    @Test
    public void test() {
        earliestFullBloom(new int[]{1, 2, 3}, new int[]{1, 2, 3});
    }
}
